<template>
	<swiper class="article-list-container" @change="handle_change" :current="active_index">
		<swiper-item v-for="(item,index) in label" :key="index">
			<ListItem :cate="item.name" :is_active="index===active_index" :is_init="index===0" />
		</swiper-item>
	</swiper>
</template>

<script>
	export default {
		name: "ArticleList",
		props: {
			label: Array,
			active_index: {
				type: Number,
				default: 0
			}
		},
		methods: {
			handle_change(e) {
				// 小程序不支持 ref 
				this.$parent.$children[1].toggle_category(e.detail.current)
			}
		}
	}
</script>
